import request from '@/api/request'

export interface CaptchaVO {
  captchaId: string
  captchaImage: string // base64 图片
}

export interface VerifyCaptchaDTO {
  captchaId: string
  captchaCode: string
}

/**
 * 获取图片验证码
 */
export async function getCaptchaApi() {
  return request<CaptchaVO>({
    url: '/auth/captcha',
    method: 'GET',
  })
}

/**
 * 验证验证码（可选，登录时会一起验证）
 */
export async function verifyCaptchaApi(data: VerifyCaptchaDTO) {
  return request<string>({
    url: '/auth/captcha/verify',
    method: 'POST',
    data,
  })
}
